package com.zj.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import java.util.Map;

//@Configuration
//@EnableWebMvc//引入swagger必须要添加
public class BeanFactoryTest implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        //org.springframework.web.servlet.config.annotation
        Map<String, WebMvcConfigurationSupport> beans = beanFactory.getBeansOfType(WebMvcConfigurationSupport.class, false, false);
//        Object bean11 = beanFactory.getBean(org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration.class);

//        Object bean2 = beanFactory.getBean("org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter");
        WebMvcConfigurationSupport bean3 = beanFactory.getBean(WebMvcAutoConfiguration.EnableWebMvcConfiguration.class);

        System.out.println("aa");

        return;

    }
}
